// import { TOKEN_KEY } from '@/constants'

export const getToken = () => {
  return localStorage.getItem(TOKEN_KEY)
}

export const setToken = (token: string) => {
  localStorage.setItem(TOKEN_KEY, token)
}

export const removeToken = () => {
  localStorage.removeItem(TOKEN_KEY)
}
// 专门用来操作cookie的方法包
// 内部封装了繁琐的操作方法 参数处理 暴露三个函数 get,set,remove
import Cookies from 'js-cookie'
import { TOKEN_KEY } from '@/constants'
// 获取token的方法
export const getLocalToken = () => {
  return Cookies.get(TOKEN_KEY)
}

// 设置方法
export const setLocalToken = (token: string) => {
  Cookies.set(TOKEN_KEY, token)
}

// 删除方法
export const removeLocalToken = () => {
  Cookies.remove(TOKEN_KEY)
}